import config from "@/config"
import http from "@/utils/request"

export default {
	list: {
		name: "用户列表",
		url: `${config.API_URL}/admin/user/list`,
		get: function (id, params) {
			return http.get(this.url.replace(':id', id), params);
		},
	},
	detail: {
		name: "用户详情",
		url: `${config.API_URL}/admin/user/:id`,
		get: function (id) {
			return http.get(this.url.replace(':id', id));
		},
		delete: function (id) {
			return http.delete(this.url.replace(':id', id));
		},
		put: function (id, data) {
			return http.put(this.url.replace(':id', id), data);
		},
	},
	create: {
		name: "添加用户",
		url: `${config.API_URL}/admin/user/create`,
		post: function (data) {
			return http.post(this.url, data);
		},
	},
	credentials: {
		name: "修改密码",
		url: `${config.API_URL}/admin/user/:id/password`,
		put: function (id, data) {
			return http.put(this.url.replace(':id', id), data);
		},
	},
};
